home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Draw / CCE.as < prev    next >
Text File  |  2011-08-19  |  6KB  |  206 lines

  1. package Local.Draw
  2. {
  3.    import flash.display.BitmapData;
  4.    import flash.display.Graphics;
  5.    import flash.display.MovieClip;
  6.    import flash.filters.BlurFilter;
  7.    import flash.filters.GlowFilter;
  8.    import flash.geom.Matrix;
  9.    import flash.geom.Point;
  10.    import flash.geom.Rectangle;
  11.    
  12.    public class CCE extends MovieClip
  13.    {
  14.       
  15.       public static const zPoint:Point;
  16.       
  17.       {
  18.          if(true)
  19.          {
  20.             zPoint = new Point(0,0);
  21.          }
  22.       }
  23.       
  24.       private var mSize:Number;
  25.       
  26.       private var mEase:Number;
  27.       
  28.       private var mFrames:Array;
  29.       
  30.       private var mEaseDecay:Number;
  31.       
  32.       private var mCount:int;
  33.       
  34.       private var mFilters:Array;
  35.       
  36.       private var mParticles:Object;
  37.       
  38.       public function CCE(param1:Number = 1)
  39.       {
  40.          super();
  41.          mParticles = new Object();
  42.          mFrames = new Array();
  43.          mCount = 15;
  44.          mEase = 7;
  45.          mEaseDecay = 0.8;
  46.          mSize = param1;
  47.          mFilters = [new BlurFilter(2,2,3),new GlowFilter(16777215,1,16 * mSize,16 * mSize,5,3)];
  48.       }
  49.       
  50.       public function RenderFrames() : Array
  51.       {
  52.          var _loc1_:* = uint(0);
  53.          var _loc2_:Object = null;
  54.          var _loc3_:int = 0;
  55.          var _loc4_:int = 0;
  56.          loop0:
  57.          while(true)
  58.          {
  59.             this.graphics.clear();
  60.             if(true)
  61.             {
  62.                _loc4_ = mEase;
  63.                if(true)
  64.                {
  65.                   while(true)
  66.                   {
  67.                      if(!_loc4_)
  68.                      {
  69.                         mEase = Math.max(1,mEase * mEaseDecay);
  70.                         addr65:
  71.                         if(_loc3_ == 0)
  72.                         {
  73.                            break;
  74.                         }
  75.                         mFrames.push(RenderAsBMD());
  76.                      }
  77.                      else
  78.                      {
  79.                         _loc3_ = Process();
  80.                         if(true)
  81.                         {
  82.                            continue;
  83.                         }
  84.                      }
  85.                      continue loop0;
  86.                   }
  87.                   _loc1_ = uint(0);
  88.                }
  89.                for each(_loc2_ in mFrames)
  90.                {
  91.                   if(true)
  92.                   {
  93.                      ┬º┬ºpush(_loc1_);
  94.                      if(true)
  95.                      {
  96.                         ┬º┬ºpush(uint(┬º┬ºpop() + _loc2_.bmd.width * _loc2_.bmd.height * 4));
  97.                      }
  98.                      _loc1_ = ┬º┬ºpop();
  99.                   }
  100.                }
  101.                break;
  102.             }
  103.             break;
  104.          }
  105.          return mFrames;
  106.       }
  107.       
  108.       public function AddParticles() : void
  109.       {
  110.          var _loc1_:Number = NaN;
  111.          var _loc2_:* = NaN;
  112.          var _loc3_:Point = null;
  113.          var _loc4_:CCE_Particle = null;
  114.          if(true)
  115.          {
  116.             _loc1_ = Math.random() * 360;
  117.             _loc2_ = Number(30);
  118.          }
  119.          while(_loc2_)
  120.          {
  121.             _loc3_ = Point.polar(Math.random() * 10 * mSize,Math.random() * Math.PI * 2);
  122.             _loc4_ = new CCE_Particle(new Point(0,0),_loc3_);
  123.             mParticles[_loc4_.mID] = _loc4_;
  124.             ┬º┬ºpush(_loc2_);
  125.             if(true)
  126.             {
  127.                ┬º┬ºpush(Number(┬º┬ºpop() - 1));
  128.             }
  129.             _loc2_ = ┬º┬ºpop();
  130.          }
  131.       }
  132.       
  133.       private function Process() : int
  134.       {
  135.          var _loc1_:int = 0;
  136.          var _loc2_:CCE_Particle = null;
  137.          var _loc3_:*;
  138.          ┬º┬ºpush((_loc3_ = ┬º┬ºfindproperty(mCount)).mCount);
  139.          if(true)
  140.          {
  141.             var _loc4_:*;
  142.             ┬º┬ºpush(_loc4_ = ┬º┬ºpop() - 1);
  143.             if(true)
  144.             {
  145.                _loc3_.mCount = _loc4_;
  146.             }
  147.          }
  148.          if(┬º┬ºpop() > 0)
  149.          {
  150.             AddParticles();
  151.          }
  152.          _loc1_ = 0;
  153.          for each(_loc2_ in mParticles)
  154.          {
  155.             ┬º┬ºpush(_loc2_.Process());
  156.             if(true)
  157.             {
  158.                if(┬º┬ºpop())
  159.                {
  160.                   _loc1_++;
  161.                   continue;
  162.                }
  163.                ┬º┬ºpush(delete mParticles[_loc2_.mID]);
  164.             }
  165.             ┬º┬ºpop();
  166.          }
  167.          return _loc1_;
  168.       }
  169.       
  170.       private function Render() : void
  171.       {
  172.          var _loc1_:Graphics = null;
  173.          var _loc2_:CCE_Particle = null;
  174.          _loc1_ = this.graphics;
  175.          for each(_loc2_ in mParticles)
  176.          {
  177.             _loc2_.Render(_loc1_);
  178.          }
  179.       }
  180.       
  181.       private function RenderAsBMD() : Object
  182.       {
  183.          var _loc1_:Rectangle = null;
  184.          var _loc2_:BitmapData = null;
  185.          var _loc3_:Point = null;
  186.          var _loc4_:* = undefined;
  187.          _loc1_ = this.getBounds(this);
  188.          _loc1_.inflate(16 * mSize,16 * mSize);
  189.          _loc2_ = new BitmapData(_loc1_.width,_loc1_.height,true,16711680);
  190.          _loc3_ = new Point(Math.floor(_loc1_.left),Math.floor(_loc1_.top));
  191.          if(true)
  192.          {
  193.             _loc2_.draw(this,new Matrix(1,0,0,1,-_loc3_.x,-_loc3_.y));
  194.          }
  195.          for each(_loc4_ in mFilters)
  196.          {
  197.             _loc2_.applyFilter(_loc2_,_loc2_.rect,zPoint,_loc4_);
  198.          }
  199.          return {
  200.             "bmd":_loc2_,
  201.             "disp":_loc3_
  202.          };
  203.       }
  204.    }
  205. }
  206.